package com.chinasofti.myjdk8datetime;

import java.text.ParseException;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;

// 时间的间隔
public class JDK8DateDemo9 {
    public static void main(String[] args) throws ParseException {
        LocalDateTime localDate1 =
                LocalDateTime.of(2020,1,1,13,14,15);
        LocalDateTime localDate2 =
                LocalDateTime.of(2040,12,12,11,12,13);

        Duration duration = Duration.between(localDate1,localDate2);
        System.out.println(duration);
        System.out.println(duration.toNanos());//获取纳秒
        System.out.println(duration.toDays());
        System.out.println("duration.toMinutes() = " + duration.toMinutes());


    }

}
